package org.liux.android.game.jumpgame.character;

public class TriangleLeft extends Shape {
	
	public static final int STATE_1 = 0;
	public static final int STATE_2 = 1;
	
	/**      STATE_1                              STATE_2
	 *       
	 *             #                                              
	 *         #  #                                     #  #           
	 *         #                                             #  #
	 */

	@Override
	public void change(Coordinate c) {
		int x = c.x;
		int y = c.y;
		
		if (mShapeList.size() > 0) {
			mShapeList.clear();
		}
		
		if(mState == STATE_1){
			mShapeList.add(new Coordinate(x-1, y+1));
			mShapeList.add(new Coordinate(x, y+1));
			mShapeList.add(new Coordinate(x, y+2));
			mShapeList.add(new Coordinate(x+1, y+2));
			mOldState = mState;
			mState=STATE_2;
			return;
		}
		if(mState == STATE_2){
			mShapeList.add(new Coordinate(x+1, y-1));
			mShapeList.add(new Coordinate(x+1, y));
			mShapeList.add(new Coordinate(x, y));
			mShapeList.add(new Coordinate(x, y+1));
			mOldState = mState;
			mState=STATE_1;
			return;
		}

	}

	@Override
	public void initCoord() {
		mShapeList.add(new Coordinate(mMidWidth, 50));
		mShapeList.add(new Coordinate(mMidWidth, 100));
		mShapeList.add(new Coordinate(mMidWidth-1, 100));
		mShapeList.add(new Coordinate(mMidWidth-1, 200));
		
	}

}
